package com.alone.embedded.lucene.repository.query.wrapper;

import com.alone.embedded.lucene.core.Source;
import com.alone.embedded.lucene.repository.hightlight.HighlightRender;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;

import java.util.Set;

/**
 * @author Alone
 * @date 2022/8/9 2:23 下午
 */
public interface QueryWrapper<T> {


    /**
     * 获取查询的字段，空即全部
     *
     * @return Set
     */
    Set<String> getSelect();

    /**
     * 转换成Query
     *
     * @return query
     */
    Query getQuery();

    /**
     * 转换成Sort
     *
     * @return sort
     */
    Sort getSort();

    /**
     * 转换成HighlightRender
     *
     * @return HighlightRender
     */
    default HighlightRender getHighlightRender() {
        return null;
    }

    /**
     * limit
     *
     * @return int
     */
    int getLimit();

    /**
     * 设置source
     *
     * @param source source
     */
    void setSource(Source<T> source);

}
